﻿$(function () {

})
function load() {
    var num = 0;
    var loadBtn = $(".bt")//获取属性
    var loadText = $(".loadText")
    var loadBar = $(".loadBar")
    var progressInterval = setInterval(function () {
        if (num < 1000) {
            num++
            var Progresswidth = (num / 2.5).toFixed() + "px";//这里设置进度条为100px
            loadBtn.attr('disabled', true).css({//点击后button禁止点击
                'opacity': '0.5',
                'cursor': 'no-drop',
            });
            loadText.text(parseInt(num / 10) + "%");
            loadBar.css({
                'width': Progresswidth,
                'background': "linear-gradient(90deg,#ffd33d 10%,#ea4aaa 30%,#b34bff 51%,#ffb33d 68%, #ea4aaa 85%,#b34bff)"
            });
        } else {
            loadBtn.attr('disabled', false).css({
                'opacity': '1',
                'cursor': 'pointer',
            });
            loadText.text("启动成功")
            clearInterval(progressInterval)//执行后清除Interval
        }
    }, 1)//这里我们设置成1毫秒执行一次，要执行1000次
}